Quiz Comment Box

SORTING ALGORITHMS

A sorting algorithm is used to arrange elements of an array/list in a specific order.

There are various sorting algorithms that can be used to complete this operation. And, we can use any algorithm based on the requirement.

TYPES OF SORTING ALGORITHMS

bubble sort
selection sort
heap sort
merge sort
quicksort
insertion sort

COMPLEXITY OF SORTING ALGORITHMS

The efficiency of any sorting algorithm is determined by the time complexity and space complexity of the algorithm.

  1. Time complexity: time complexity refers to the time taken by an algorithm to complete its execution with respect to the size of the input. It can be represented in different forms:
    • big-o notation (o)
    • omega notation (ω)
    • theta notation (θ)
  2. Space complexity: space complexity refers to the total amount of memory used by the algorithm for a complete execution. It includes both the auxiliary memory and the input.

    The auxiliary memory is the additional space occupied by the algorithm apart from the input data. Usually, auxiliary memory is considered for calculating the space complexity of an algorithm.

    A sorting algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of elements in the respective data structure.
previous

Searching Introduction